{% extends "base_generic.html" %}

{% block content %}
  <h2>搜索结果: "{{ request.GET.q }}"</h2>
  {% if search_results %}
    <ul class="list-group mt-3">
      {% for book in search_results %}
        <li class="list-group-item">
          <a href="{% url 'book-detail' book.pk %}">{{ book.title }}</a>
          <p>作者: {{ book.author.first_name }} {{ book.author.last_name }}</p>
          <p>类别: {% for genre in book.genre.all %}{{ genre.name }}{% if not forloop.last %}, {% endif %}{% endfor %}</p>
        </li>
      {% endfor %}
    </ul>
  {% else %}
    <p class="mt-3">没有找到匹配的书籍或作者。</p>
  {% endif %}
{% endblock %}